{*-----------------------------------------------
	db_table_controller helper template


-------------------------------------------------*}
	{if !$WGT_TABLE_KEY}warning: no key specified<br>{/if}
	<table border="1">
		<tr>
			{foreach from=$WGT_TABLE_STRUCT item="struct"}
				<th>{$struct.name}</th>
			{/foreach}
			
			<th></th>
		</tr>
		
		{foreach from=$WGT_TABLE_DATA item="data"}
			<tr>
				{assign var="__row_id" value=$data.$WGT_TABLE_KEY}
				
				{foreach from=$WGT_TABLE_STRUCT item="struct"}
					<td>
						{assign var="__field_name" value=$struct.name}
						{$data.$__field_name}
					</td>
				{/foreach}
				
				{if $WGT_TABLE_KEY}
					<th>
						<a href="?{$__CORE.request}&db_action=__db_ctrl_edit&row_id={$__row_id}">edit</a>
					</th>
					<th>
						<a href="?{$__CORE.request}&db_action=__db_ctrl_delete&row_id={$__row_id}">X</a>
					</th>
				{/if}
			</tr>
		{/foreach}
		<tr>
			<td colspan="{$WGT_TABLE_STRUCT|@count}" align="center">
				<a href="?{$__CORE.request}&db_action=__db_ctrl_add">add</a>
			</td>
		</tr>
	</table>
